package org.tiny.spring.beans.factory;

import org.tiny.spring.beans.factory.config.BeanDefinition;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author QingFan
 * @version 1.0.0
 * @date 2023年11月30日 22:13
 */
public class BeanFactory {

    Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>();

    public Object getBean(String bean) {
        return beanDefinitionMap.get(bean).getBean();
    }

    public void registerBeanDefinition(String bean, BeanDefinition beanDefinition) {
        beanDefinitionMap.put(bean, beanDefinition);
    }
}
